package org.example.forum.dao;

import org.apache.ibatis.annotations.Mapper;
import org.example.forum.model.Message;

import java.util.List;

@Mapper
public interface MessageMapper {
    int insert(Message record);

    int insertSelective(Message record);

    Message selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(Message record);

    int updateByPrimaryKey(Message record);

    /**
     * 根据用户id查询未读消息数量
     * @param receiveUserId
     * @return
     */
    Integer selectUnreadCount(Long receiveUserId);

    /**
     * 根据接受者id展示私信列表
     * @param receiveUserId
     * @return
     */
    List<Message> selectByReceiveUserId(Long receiveUserId);
}